package cc.wsyw126.java.interview.sogou;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;

/**
 * Created by Administrator on 2017/9/8.
 */
public class Main2 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int position = 0;
        double list[] = new double[n];
        double max = 0.0;
        while (position < n) {
            list[position] = Double.valueOf(br.readLine());
            for (int i = 0; i < position; i++) {
                double calc = calc(list[i], list[position]);
                if (calc > max) {
                    max = calc;
                }
                if (list[position] - list[i] < 180.0) {
                    break;
                }
            }
            position++;
        }
        DecimalFormat df = new DecimalFormat("######0.00000000");
        System.out.println(df.format(max));
    }

    private static double calc(double a, double b) {
        double abs = Math.abs(a - b);
        return abs > 180 ? abs - 180 : abs;
    }
}